package com.xiyoufang.club.repository;

import java.util.List;

import com.xiyoufang.club.entity.ClubApply;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public abstract interface ClubApplyRepository
        extends JpaRepository<ClubApply, Integer> {
    @Query(nativeQuery = true, value = "SELECT * FROM club_apply t WHERE t.club_id=:clubId AND  t.user_id=:userId AND t.state=1 ORDER BY create_time DESC")
    public abstract List<ClubApply> findClubMembersByClubIdAndUserId(@Param("clubId") int paramInt1, @Param("userId") int paramInt2);

    @Query(nativeQuery = true, value = "SELECT * FROM club_apply t WHERE t.club_id=:clubId AND  t.user_id=:userId AND t.apply_user_id=:applyUserId AND t.state=1 LIMIT 1")
    public abstract ClubApply getClubMembersByClubIdAndUserIdAndApplyUserId(@Param("clubId") int paramInt1, @Param("userId") int paramInt2, @Param("applyUserId") int paramInt3);
}
